﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;
using DTO;
using BUS;

public partial class TimKiemNangCao : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            #region Dien thoai

            List<string> listTenHangSanXuatDienThoai = HangSanXuatBUS.LayDanhSachTenHangSanXuatTheoNhomSanPham(2);
            List<string> listKichThuocManHinhDienThoai = ChiTietDienThoaiBUS.LayDanhSachCacLoaiManHinh();
            List<string> listKieuDangDienThoai = ChiTietDienThoaiBUS.LayDanhSachCacKieuDang();

            ddlHangSanXuatDienThoai.Items.Add("Tùy ý");
            ddlKichThuocManHinhDienThoai.Items.Add("Tùy ý");
            ddlKieuDangDienThoai.Items.Add("Tùy ý");
            for (int i = 0; i < listTenHangSanXuatDienThoai.Count; i++)
            {
                ddlHangSanXuatDienThoai.Items.Add(listTenHangSanXuatDienThoai[i]);
            }
            for (int i = 0; i < listKichThuocManHinhDienThoai.Count; i++)
            {
                ddlKichThuocManHinhDienThoai.Items.Add(listKichThuocManHinhDienThoai[i]);
            }

            for (int i = 0; i < listKieuDangDienThoai.Count; i++)
            {
                ddlKieuDangDienThoai.Items.Add(listKieuDangDienThoai[i]);
            }

            ddlKichThuocManHinhDienThoai.SelectedIndex = 0;
            ddlKieuDangDienThoai.SelectedIndex = 0;
            ddlHangSanXuatDienThoai.SelectedIndex = 0;

            #endregion

            #region Lap top

            HienThiHangSanXuatLapTop();

            HienThiThongTinCPU();

            HienThiTocDoCPU();

            HienThiKichThuocManHinhLapTop();

            HienThiDungLuongVGA();

            HienThiDungLuongRAM();

            HienThiDungLuongHDD();

            HienThiPin();

            HienThiThongTinHeDieuHanh();

            HienTriTrongLuongMay();

            #endregion
        }
       
    }

    private void HienTriTrongLuongMay()
    {
        ddlTrongLuongMayTu.Items.Add("1.38 kg");
        ddlTrongLuongMayTu.Items.Add("1.9 kg");
        ddlTrongLuongMayTu.Items.Add("2 kg");
        ddlTrongLuongMayTu.SelectedIndex = 0;

        ddlTrongLuongMayDen.Items.Add("2.4 kg");
        ddlTrongLuongMayDen.Items.Add("2.8 kg");
        ddlTrongLuongMayDen.Items.Add("3 kg");
        ddlTrongLuongMayDen.SelectedIndex = 0;
    }

    private void HienThiThongTinHeDieuHanh()
    {
        ddlThongTinHeDieuHanh.Items.Add("Tùy ý");
        ddlThongTinHeDieuHanh.Items.Add("Free dos");
        ddlThongTinHeDieuHanh.Items.Add("Windows");
        ddlThongTinHeDieuHanh.Items.Add("Linux");
        ddlThongTinHeDieuHanh.SelectedIndex = 0;
    }

    private void HienThiPin()
    {
        ddlPin.Items.Add("Tùy ý");
        ddlPin.Items.Add("3 cell");
        ddlPin.Items.Add("6 cell");
        ddlPin.Items.Add("9 cell");
        ddlPin.SelectedIndex = 0;
    }

    private void HienThiDungLuongHDD()
    {
        ddlDungLuongHDDTu.Items.Add("120 GB");
        ddlDungLuongHDDTu.Items.Add("160 GB");
        ddlDungLuongHDDTu.Items.Add("200 GB");
        ddlDungLuongHDDTu.SelectedIndex = 0;

        ddlDungLuongHDDDen.Items.Add("250 GB");
        ddlDungLuongHDDDen.Items.Add("500 GB");
        ddlDungLuongHDDDen.Items.Add("800 GB");
        ddlDungLuongHDDDen.SelectedIndex = 0;
    }

    private void HienThiDungLuongRAM()
    {
        ddlDungLuongRAMTu.Items.Add("512 MB");
        ddlDungLuongRAMTu.Items.Add("1 G");
        ddlDungLuongRAMTu.SelectedIndex = 0;

        ddlDungLuongRAMDen.Items.Add("1 GB");
        ddlDungLuongRAMDen.Items.Add("2 GB");
        ddlDungLuongRAMDen.Items.Add("3 GB");
        ddlDungLuongRAMDen.Items.Add("4 GB");
        ddlDungLuongRAMDen.SelectedIndex = 0;
    }

    private void HienThiDungLuongVGA()
    {
        ddlDungLuongVGATu.Items.Add("64 MB");
        ddlDungLuongVGATu.Items.Add("128 MB");
        ddlDungLuongVGATu.Items.Add("512 MB");
        ddlDungLuongVGATu.SelectedIndex = 0;

        ddlDungLuongVGADen.Items.Add("1 GB");
        ddlDungLuongVGADen.Items.Add("2 GB");
        ddlDungLuongVGADen.SelectedIndex = 0;
    }

    private void HienThiKichThuocManHinhLapTop()
    {
        ddlKichThuocManHinhLapTop.Items.Add("Tùy ý");
        ddlKichThuocManHinhLapTop.Items.Add("13 inch");
        ddlKichThuocManHinhLapTop.Items.Add("14 inch");
        ddlKichThuocManHinhLapTop.Items.Add("15 inch");
        ddlKichThuocManHinhLapTop.SelectedIndex = 0;
    }

    private void HienThiTocDoCPU()
    {
        ddlTocDoCPUTu.Items.Add("1.6 GHz");
        ddlTocDoCPUTu.Items.Add("2.0 GHz");
        ddlTocDoCPUTu.SelectedIndex = 0;

        ddlTocDoCPUDen.Items.Add("2.4 GHz");
        ddlTocDoCPUDen.Items.Add("2.53 GHz");
        ddlTocDoCPUDen.Items.Add("2.8 Ghz");
        ddlTocDoCPUDen.SelectedIndex = 0;
    }

    private void HienThiThongTinCPU()
    {
        ddlThongTinCPU.Items.Add("Tùy ý");
        ddlThongTinCPU.Items.Add("Core 2 Duo");
        ddlThongTinCPU.Items.Add("Dual Core");
        ddlThongTinCPU.Items.Add("Core i3");
        ddlThongTinCPU.Items.Add("Core i5");
        ddlThongTinCPU.Items.Add("Core i7");
        ddlThongTinCPU.SelectedIndex = 0;
    }

    private void HienThiHangSanXuatLapTop()
    {
        List<string> listTenHangSanXuatLapTop = HangSanXuatBUS.LayDanhSachTenHangSanXuatTheoNhomSanPham(1);

        ddlHangSanXuatLapTop.Items.Add("Tùy ý");
        for (int i = 0; i < listTenHangSanXuatLapTop.Count; i++)
        {
            ddlHangSanXuatLapTop.Items.Add(listTenHangSanXuatLapTop[i]);
        }
        ddlHangSanXuatLapTop.SelectedIndex = 0;
    }
    protected void bttSearchNangCaoDienThoai_Click(object sender, EventArgs e)
    {
        string hangsanxuat = ddlHangSanXuatDienThoai.Text;
        string kieudang = ddlKieuDangDienThoai.Text;
        string kichthuocmanhinhdienthoai = ddlKichThuocManHinhDienThoai.Text;
        bool bonhotrong = ckbBoNhoTrongDienThoai.Checked;
        bool bonhongoai = ckbBoNhoNgoaiDienThoai.Checked;
        bool _3G = ckb3G.Checked;
        bool wifi = ckbWifi.Checked;

        string path = ResolveClientUrl("~/KetQuaTimKiemDienThoaiNangCao.aspx");
        Response.Redirect(path + "?hangsanxuat=" + hangsanxuat +
            "&kieudang=" + kieudang + "&kichthuocmanhinh=" + kichthuocmanhinhdienthoai +
            "&bonhotrong=" + bonhotrong.ToString() + "&bonhongoai=" + bonhongoai.ToString() +
            "&3g=" + _3G.ToString() + "&wifi=" + wifi.ToString());
      
    }

    protected void bttSearchNangCaoLapTop_Click(object sender, EventArgs e)
    {
        string hangsanxuatlaptop = ddlHangSanXuatLapTop.Text;
        string thongtincpu = ddlThongTinCPU.Text;
        string tocdocputu = ddlTocDoCPUTu.Text;
        string tocdocpuden = ddlTocDoCPUDen.Text;
        string kichthuocmanhinhlaptop = ddlKichThuocManHinhLapTop.Text;
        string dungluongvgatu = ddlDungLuongVGATu.Text;
        string dungluongvgaden = ddlDungLuongVGADen.Text;
        string dungluongramtu = ddlDungLuongRAMTu.Text;
        string dungluongramden = ddlDungLuongRAMDen.Text;
        string dungluonghddtu = ddlDungLuongHDDTu.Text;
        string dungluonghddden = ddlDungLuongHDDDen.Text;
        string dungluongpin = ddlPin.Text;
        string thongtinhedieuhanh = ddlThongTinHeDieuHanh.Text;
        string trongluongmaytu = ddlTrongLuongMayTu.Text;
        string trongluongmayden = ddlTrongLuongMayDen.Text;

        string path = ResolveClientUrl("~/KetQuaTimKiemLapTopNangCao.aspx");
        Response.Redirect(path + "?hangsanxuat=" + hangsanxuatlaptop +
            "&thongtincpu=" + thongtincpu +
            "&tocdocputu=" + tocdocputu + "&tocdocpuden=" + tocdocpuden +
            "&kichthuocmanhinh=" + kichthuocmanhinhlaptop +
            "&dungluongvgatu=" + dungluongvgatu + "&dungluongvgaden=" + dungluongvgaden +
            "&dungluongramtu=" + dungluongramtu + "&dungluongramden=" + dungluongramden +
            "&dungluonghddtu=" + dungluonghddtu + "&dungluonghddden=" + dungluonghddden +
            "&dungluongpin=" + dungluongpin + "&thongtinhedieuhanh=" + thongtinhedieuhanh +
            "&trongluongmaytu=" + trongluongmaytu + "&trongluongmayden=" + trongluongmayden);

    }
}
